package com.hzf.booklibrary.api.book;

import com.hzf.booklibrary.base.Constant;
import com.hzf.booklibrary.bean.BookListBean;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class BookListApi {

    public static BookListApi instance;

    private BookListApiService service;

    public BookListApi() {
        //联网请求
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Constant.BASE_BOOK_URL)
                // 添加Gson转换器
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        service = retrofit.create(BookListApiService.class);

    }

    public static BookListApi getInstance() {
        if (instance == null)
            instance = new BookListApi();
        return instance;
    }

    public Call<BookListBean> getBookList(String token,Integer classNumber,String orgId,Integer page,Integer pageSize){
        return service.getBookList(token,classNumber,orgId,page,pageSize);
    }

}
